﻿using System;

namespace WindowsFormsApplication9
{
    //--------------
    public class Person : IComparable
    {
        public virtual int CompareTo(object obj)
        {
            int result = -1;
            Person aa = (Person)obj;
            if (this.FName == aa.FName && this.Age == aa.Age && this.LName == aa.LName)
            { result = 0; }
            return result;
        }
        public virtual string ReturnLineToCsv()
        {
            return String.Format("{0};{1};{2}", this.FName, this.LName, this.Age);
        }
        public virtual void CreateFromLineCsv(string LineFromScv)
        {
            string[] line = LineFromScv.Split(';');
            this.Id = Convert.ToInt32(line[0]);
            this.FName = line[1];
            this.LName = line[2];
            this.Age = Convert.ToInt32(line[3]);
        }

        public virtual string Type { get { return "Person"; } }
        public virtual string FName { get; set; }
        public virtual string LName { get; set; }
        public virtual int Age { get; set; }
        public virtual int Id { get; set; }
    }
}
